package com.example.kotlinExample.entity

import com.fasterxml.jackson.annotation.JsonFormat
import java.util.*
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotBlank
import javax.validation.constraints.NotNull

data class Person(
        @field:NotBlank(message = "姓名不能为空")
        var name: String,

        @field:NotNull(message = "年龄不能为空")
        @field:Min(value = 18, message = "年龄不能小于18岁")
        @field:Max(value = 70, message = "年龄不能大于70岁")
        var age: Int,
        @field:NotNull(message = "生日不能为空")
        @JsonFormat(pattern = "yyyy-MM-dd")
        var birthday: Date
)